//
//  BequoteCell.m
//  Zhiche-Carriage
//
//  Created by 王亚陆 on 16/6/14.
//  Copyright © 2016年 LeeBruce. All rights reserved.
//

#import "BequoteCell.h"
#import <Masonry.h>
@implementation BequoteCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        
        _title = [self createUIlabel:@"合计运费:" andFont:FontOfSize14 andColor:BlackColor];
        [self.contentView addSubview:_title];
        [_title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_left).with.offset(100*kWidth);
            make.centerY.mas_equalTo(self.contentView.mas_centerY);
        }];
        _field =[[UITextField alloc]init];
        _field.delegate = self;
        _field.userInteractionEnabled = YES;
        _field.textAlignment = NSTextAlignmentLeft;
        [_field setFont:[UIFont fontWithName:@"STHeitiSC" size:FontOfSize12]];
        [self.contentView addSubview:_field];
        [_field mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_title.mas_right).with.offset(10*kWidth);
            make.centerY.mas_equalTo(_title.mas_centerY);
            make.size.mas_equalTo(CGSizeMake(Main_Width/2, 50*kHeight));
        }];
        _price = [self createUIlabel:@"" andFont:FontOfSize14 andColor:BlackColor];
        _price.hidden = YES;
        [self.contentView addSubview:_price];
        [_price mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.contentView.mas_centerY);
            make.right.mas_equalTo(self.contentView.mas_right).with.offset(-14*kWidth);
        }];


    }
    return self;
    
}
-(UILabel*)createUIlabel:(NSString *)title andFont:(CGFloat)font andColor:(UIColor*)color {
    UILabel * label =[[UILabel alloc]init];
    label.text = title;
    label.textColor = color;
    UIFont *fnt = [UIFont fontWithName:@"HelveticaNeue" size:font];CGSize size = [label.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:fnt,NSFontAttributeName, nil]];
    // 名字的H
    CGFloat nameH = size.height;
    // 名字的W
    CGFloat nameW = size.width;
    label.textAlignment = NSTextAlignmentRight;
    label.frame =CGRectMake(0, 0, nameW, nameH);
    label.font = Font(font);
    return label;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
